package org.example;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;

public class Collections_Demo2 {
    public static void main(String[] args) {
        //70%a~g 30%1~7
        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list,1,1,1,1,1,1,1);
        Collections.addAll(list,0,0,0);

        Random r=new Random();
        int index = r.nextInt(list.size());
        int number=list.get(index);

        ArrayList<String> list2 = new ArrayList<>();
        ArrayList<String> list3 = new ArrayList<>();
        Collections.addAll(list2,"a","b","c","d","e","f","g");
        Collections.addAll(list3,"1","2","3","4","5","6","7");

        if(number==1){
           int index2=r.nextInt(list2.size());
           System.out.println(list2.get(index2));
        }else{
            int index3=r.nextInt(list3.size());
            System.out.println(list3.get(index3));
        }
    }
}
